package com.lingxu.module.earlyWarn.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lingxu.base.common.api.vo.Result;
import com.lingxu.module.earlyWarn.entity.*;
import com.lingxu.module.earlyWarn.mapper.ModelIssueCaredMapper;
import com.lingxu.module.earlyWarn.service.ModelIssueCaredSercvice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class ModelIssueCaredServiceImpl extends ServiceImpl<ModelIssueCaredMapper, ModelIssueCared>
        implements ModelIssueCaredSercvice {

    @Autowired
    private ModelIssueCaredMapper modelIssueCaredMapper;

    @Override
    @Transactional
    public Result addModelIssueCared(String issueid, String userId) {
        modelIssueCaredMapper.deleteModelIssueCared(issueid, userId);
        modelIssueCaredMapper.addModelIssueCared(issueid, userId);
        return Result.ok("关注成功");
    }

    @Override
    public Result deleteModelIssueCared(String issueid, String userId) {
        modelIssueCaredMapper.deleteModelIssueCared(issueid, userId);
        return Result.ok("取消关注成功");
    }
}
